<template>
    <div>
        <c-template v-loading="loading" class="mb-lg tf-paragraph">
            <el-row :gutter="24" class="info-row">
                <el-col :span="24" class="detailsTitle mb-0">企业信息</el-col>
            </el-row>
            <el-divider></el-divider>
            <el-row :gutter="24" class="info-row ">
                <el-col :span="8">公司名称：<span>{{userInfo.buyer.name}}</span></el-col>
                <el-col :span="8">联系人：<span>{{userInfo.buyerInfo == null ? "-":userInfo.buyerInfo.contactName}}</span></el-col>
                <el-col :span="8">注册地址：<span>{{userInfo.buyerInfo == null ? "-":userInfo.buyerInfo.addressDetails}}</span></el-col>
                <el-col :span="8">邮箱：<span>{{userInfo.buyer.email}}</span></el-col>
                <el-col :span="8">联系电话：<span>{{userInfo.buyerInfo == null ? "-":userInfo.buyerInfo.contactMobile}}</span></el-col>
            </el-row>
            <el-row :gutter="24" class="info-row " v-if="userInfo.buyerInfo != null">
                <el-col :span="8">
                    <el-image style="width: 18px; height: 16px" :src="iconUrl" v-if="userInfo.buyerInfo.buyerDetail.regFileList.length > 0" :preview-src-list="userInfo.buyerInfo.buyerDetail.regFileList">
                    </el-image>注册文件
                </el-col>
                <el-col :span="8">
                    <el-image style="width: 18px; height: 16px" :src="iconUrl" v-if="userInfo.buyerInfo.buyerDetail.officePicList.length > 0" :preview-src-list="userInfo.buyerInfo.buyerDetail.officePicList">
                    </el-image>办公照片
                </el-col>
                <el-col :span="8">
                    <el-image style="width: 18px; height: 16px" :src="iconUrl" :preview-src-list="[userInfo.buyerInfo.buyerDetail.signaturePrincipal]">
                    </el-image>委托人签字
                </el-col>
                <el-col :span="8">
                    <el-image style="width: 18px; height: 16px" :src="iconUrl" :preview-src-list="[userInfo.buyerInfo.buyerDetail.surname]">
                    </el-image>章模
                </el-col>
            </el-row>
        </c-template>
        <c-template v-loading="loading" class="mb-lg tf-paragraph" v-if="userInfo.buyerInfo != null">
            <el-row :gutter="24" class="info-row">
                <el-col :span="24" class="detailsTitle mb-0">银行账户信息</el-col>
            </el-row>
            <el-divider></el-divider>
            <el-row :gutter="24" class="info-row " v-for="(item,index) in userInfo.buyerInfo.buyerBankList" :key="index">
                <el-col :span="6">银行账户名：<span>{{item.accountName}}</span></el-col>
                <el-col :span="6">开户银行：<span>{{item.bankName}}</span></el-col>
                <el-col :span="6">开户行地址：<span>{{item.bankAddress}}</span></el-col>
                <el-col :span="6">银行账号：<span>{{item.accountNo}}</span></el-col>
            </el-row>
        </c-template>
        <c-template class="tf-paragraph" v-if="userInfo.buyerInfo != null">
            <el-row :gutter="24" class="info-row">
                <el-col :span="24" class="detailsTitle mb-0">审批记录</el-col>
            </el-row>
            <el-divider></el-divider>
            <c-approval-process ref="approvalProcess" :id="userInfo.buyerInfo.id" :loading="loading" :supplierName="userInfo.buyerInfo.name" @isLoading="changeLoading"></c-approval-process>
        </c-template>
    </div>
</template>
<script>

import cApprovalProcess from './components/c-approval-process.vue';
export default {
    components: {
        cApprovalProcess
    },
    data () {

        return {
            iconUrl: require("@/assets/img/icon_Attachment@2x.png"),
            loading: false,
            userInfo: {},
            rules: {},
            id: "",
            isExamine: false,
            userInfo: {
                buyer: {},
                buyerInfo: {
                    buyerDetail: {
                        regFileList: [],
                        officePicList: []
                    }
                }
            }
        };
    },
    beforeCreate () {
        this.isView = this.$route.query.isView
    },
    mounted () {
        this.getInfo()
    },
    methods: {
        changeLoading (loading) {
            this.loading = loading
        },
        async getInfo () {
            if (this.$route.query.id) {
                this.isView = eval(this.$route.query.isView)
                this.id = this.$route.query.id
                const params = {
                    id: this.$route.query.id,
                };
                this.loading = true;
                let res = await this.$get({ url: "/buyerInfo/getById", params })
                this.userInfo = res

                this.loading = false;
                // this.$refs.approvalProcess.getFlowsList()
            }
        },
    },
};
</script>
<style scoped lang="scss">
</style>
